/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.seari.cctv.handler;

import com.seari.utils.DataUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import java.util.List;
import org.slf4j.LoggerFactory;


/**
 *
 * @author 29120
 */
public class CctvDecoder extends ByteToMessageDecoder{
    
    //protected static org.slf4j.Logger logger = LoggerFactory.getLogger(CctvDecoder.class);
    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception
    {
          byte[] bytes = new byte[in.readableBytes()];
          in.readBytes(bytes);
          String str = DataUtil.BytesToHexStr(bytes);
          String str1 = DataUtil.hexStringToString(str);
          out.add(str1);
    }
    
}
